import Api from "@/api/api-declare";

export function useDriverAuth() {	

	const authData = ref({
		tel: '',
		name: '',
		id: '', //身份证号
	});

	/**
	 * 获取司机审核信息
	 * @param {boolean} force 是否强制从服务端拉取最新数据
	 */
	const getAuthData = (force = false): Promise<void> => {
		return new Promise((r) => {
			if (!force && authData.value.tel) {
				r();
			};
			// 获取用户信息
			Api.ApiDriverUser.getAuthData().then(res => {
				authData.value = res;
				r();
			});
		});

	};

	return {
		authData,
		getAuthData
	};
};